/**
 * 数组去重
 * @param {Array} arr
 */
 export function uniqueArr(arr:Array<any>):Array<any> {
  if(!Array.isArray(arr)){
    throw new Error('not Array')
  }
  return Array.from(new Set(arr))
}
export function uniqueObjArr(objArr:Array<any>,key:String) {
  if(!Array.isArray(objArr)){
    throw new Error('not Array')
  }
  const keyMap:any = {}
  return objArr.reduce((result:any,item:any)=>{
    if(!keyMap[item[key as string]]){
      result.push(item)
      keyMap[item[key as string]] = true
    }
    return result
  },[] as Array<any>)
}
